﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class CommandButtonPanel : ConsoleComponent
{

    private List<string> commandStrList;

    public CommandButtonPanel()
    {
        commandStrList = new List<string>();
    }

    public void AddPresetCommandStr(string s)
    {
        commandStrList.Add(s);
    }

    public override void OnDrawing()
    {
        for (int i = 0; i < commandStrList.Count;i ++)
        {
            // Get layout rect
            Rect buttonRect = GUIHelper.LayoutIndexRect(i, 5, DebugConsole.BTN_R_WIDTH, DebugConsole.BTN_R_HEIGHT, 0.1837112f, 0.06644553f);

            if(GUI.Button(buttonRect, commandStrList[i]))
            {
                // Execute command string through 'CommandInput' component
                DebugConsole.GetInstance().GetCommondInput().ParseConsoleCommandStr(commandStrList[i]);
            }
        }
    }
}